﻿@model PNProject.Core.PagingNews
@using PNProject;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
    int i = 0;
}
<script src="/Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<div class="admin_head">
Danh sách bài viết
</div>
@Html.HiddenFor(a=>a.NewsType)

<div class="admin_content">
 <a class="newobject" href="/AdminArticle/Create">Tạo mới</a>
 <br />
  <br />
<span style="color:Red; margin-left:10px; margin-top:2px;">(@Model.TotalItem.ToString())</span>
<br />
<br />


@foreach (var item in Model.Content)
{
    string image = !item.IsChecked ? "/Images/Base/uncheck.png" : "/Images/Base/check.png";
<div class="item-div">
<img src="@image" style="margin-right:10px; margin-bottom:-5px; width:15px; height:15px;"/>
<a class="item-delete" href="/AdminArticle/Delete/@item.NewsID.ToString()" onclick="return confirmAction()">Xóa</a>
<a class="item-link" href="/AdminArticle/Detail/@item.NewsID.ToString()">@item.Title</a>
<span>@item.CreateDate</span>
</div>
}
<hr />
@foreach (var item in Model.ListPages)
{
    if (item == Model.ActivePage)
    {
    <a class="active_page_link" href="/AdminArticle/index/?type=@Model.NewsType.ToString()&page=@item.ToString()"><span>@item.ToString() </span></a>
    }
    else
    {
    <a class="page_link" href="/AdminArticle/index/?type=@Model.NewsType.ToString()&page=@item.ToString()"><span>@item.ToString() </span></a>
    }
}
</div>
<script type="text/javascript">
    function confirmAction() {
        var confirmed = confirm("Bạn thực sự muốn thưc hiện thao tách này???");
        return confirmed;
    }
    $(document).ready(function () {
        $(select_type).change(function () {
            var url = "/AdminNews/Index?type=";
            var type = $(select_type).val();
            url = url + type + "&page=1";
            window.location = url;
        });
    });
</script>
